﻿using Coldairarrow.Business.Base_leasesystem_invoiceinformation;
using Coldairarrow.Entity.Base_leasesystem_invoiceinformation;
using Coldairarrow.Util;
using Microsoft.AspNetCore.Mvc;
using NSwag.Annotations;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace Coldairarrow.Api.Controllers.Base_leasesystem_invoiceinformation
{
    /// <summary>
    /// 开票信息控制器
    /// </summary>
    [Route("/Base_leasesystem_invoiceinformation/[controller]/[action]")]
    [OpenApiTag("开票信息控制器")]
    public class leasesystem_invoiceinformationController : BaseApiController
    {
        #region DI

        public leasesystem_invoiceinformationController(Ileasesystem_invoiceinformationBusiness leasesystem_invoiceinformationBus)
        {
            _leasesystem_invoiceinformationBus = leasesystem_invoiceinformationBus;
        }

        Ileasesystem_invoiceinformationBusiness _leasesystem_invoiceinformationBus { get; }

        #endregion

        #region 获取

        [HttpPost]
        public async Task<PageResult<leasesystem_invoiceinformation>> GetDataList(PageInput<ConditionDTO> input)
        {
            return await _leasesystem_invoiceinformationBus.GetDataListAsync(input);
        }

        [HttpPost]
        public async Task<leasesystem_invoiceinformation> GetTheData(IdInputDTO input)
        {
            return await _leasesystem_invoiceinformationBus.GetTheDataAsync(input.id);
        }

        //public async Task<object> Getinvoice_
        #endregion

        #region 提交

        [HttpPost]
        public async Task SaveData(leasesystem_invoiceinformation data)
        {
            if (data.Id.IsNullOrEmpty())
            {
                InitEntity(data);

                await _leasesystem_invoiceinformationBus.AddDataAsync(data);
            }
            else
            {
                await _leasesystem_invoiceinformationBus.UpdateDataAsync(data);
            }
        }

        [HttpPost]
        [ApiPermission("invoiceinformation.Delete")]
        public async Task DeleteData(List<string> ids)
        {
            await _leasesystem_invoiceinformationBus.DeleteDataAsync(ids);
        }

        #endregion
    }
}